package com.treetao.union.db.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.treetao.union.db.mapper.CommonUserMapper;
import com.treetao.union.db.model.CommonUser;
import com.treetao.union.db.service.CommonUserService;

/**
 * <p>
 * 前端用户 服务实现类
 * </p>
 *
 * @author Dev.M
 * @since 2020-04-11
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonUser> implements CommonUserService {

	@Override
	public int getTodayNewuserNum() {
		QueryWrapper<CommonUser> q = new QueryWrapper<CommonUser>();
		q.eq("to_days(regtime)", "to_days(now())");
		return count(q);
	}

	@Override
	public int getTotalUserNum() {
		return count();
	}

}
